<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<!-- 开发环境版本，包含了有帮助的命令行警告 -->
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
	</head>
	<body>
	 <div id="jisuan">
	        <input type="number" v-model="input1"/>
	        <select v-model="selected">
	            <option value="0">+</option>
	            <option value="1">-</option>
	            <option value="2">*</option>
	            <option value="3">/</option>
	            <option value="4">%</option>
	        </select>
	        <input type="number" v-model="input2"/>
	        <button @click="suan()">=</button>
	        <span>
			      {{ resulted }}
			</span>
	    </div>
	</body>
	</html>
	<script type="text/javascript">
	    var vm=new Vue({
	        el:'#jisuan',
	        data:{
	            input1:'',
	            input2:'',
	            selected:'',
	            resulted:'',
	        },
	        methods:{
	            suan:function () {
	                this.resulted=0;
	                if (this.selected=='0'){
	               
	                    this.resulted=(this.input1-0)+(this.input2-0);
	                }
	                if (this.selected=='1'){
	                    this.resulted=(this.input1-0)-(this.input2-0);
	                }
	                if (this.selected=='2'){
	                    this.resulted=(this.input1-0)*(this.input2-0);
	                }
	                if (this.selected=='3'){
	                    this.resulted=(this.input1-0)/(this.input2-0);
	                }
	                if (this.selected=='4'){
	                    this.resulted=(this.input1-0)%(this.input2-0);
	                }
	            }
	        }
	    })
	</script>